﻿// Groupon.NET C# Library
// Copyright (c) 2011 James Paul Duncan (JPaulDuncan)
// The MIT License (MIT)
// Permission is hereby granted, free of charge, to any person obtaining a 
// copy of this software and associated documentation files (the "Software"), 
// to deal in the Software without restriction, including without limitation 
// the rights to use, copy, modify, merge, publish, distribute, sublicense, 
// and/or sell copies of the Software, and to permit persons to whom the 
// Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included 
// in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
// DEALINGS IN THE SOFTWARE. 
// http://www.jpaulduncan.com

namespace Groupon.Net
{
    public sealed class GrouponSaying : ModelBase
    {
        private string _websiteContent;
        private string _emailContent;
        private string _websiteContentHtml;
        private string _title;
        private string _emailContentHtml;
        private string _id;


        public GrouponSaying() : base() { }

        public string WebsiteContent
        {
            get { return _websiteContent; }
            set { base.SetProperty<string>("WebsiteContent", ref _websiteContent, value); }
        }

        public string EmailContent
        {
            get { return _emailContent; }
            set { base.SetProperty<string>("EmailContent", ref _emailContent, value); }
        }

        public string WebsiteContentHTML
        {
            get { return _websiteContentHtml; }
            set { base.SetProperty<string>("WebsiteContentHTML", ref _websiteContentHtml, value); }
        }

        public string Title
        {
            get { return _title; }
            set { base.SetProperty<string>("Title", ref _title, value); }
        }

        public string EmailContentHTML
        {
            get { return _emailContentHtml; }
            set { base.SetProperty<string>("EmailContentHTML", ref _emailContentHtml, value); }
        }

        public string Id
        {
            get { return _id; }
            set { base.SetProperty<string>("Id", ref _id, value); }
        }

        internal static GrouponSaying Parse(System.Xml.XmlNode xmlNode)
        {
            GrouponSaying result = new GrouponSaying();

            if (xmlNode != null)
            {
                result.EmailContent = xmlNode.SelectSingleNode("emailContent").GetText();
                result.EmailContentHTML = xmlNode.SelectSingleNode("emailContentHtml").GetText();
                result.Id = xmlNode.SelectSingleNode("id").GetText();
                result.Title = xmlNode.SelectSingleNode("title").GetText();
                result.WebsiteContent = xmlNode.SelectSingleNode("websiteContent").GetText();
                result.WebsiteContentHTML = xmlNode.SelectSingleNode("websiteContentHtml").GetText();
            }

            return result;
        }
    }
}
